package com.ruoyi.logistics.service.impl;

import com.alibaba.excel.EasyExcel;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.easyExcelHandler.listener.logisticsTracking.QcLogisticsTrackingListener;
import com.ruoyi.logistics.domain.DTO.QcLogisticsTrackingEsDTO;
import com.ruoyi.logistics.domain.QcLogisticsTracking;
import com.ruoyi.logistics.mapper.QcLogisticsTrackingMapper;
import com.ruoyi.logistics.service.IQcLogisticsTrackingEsService;
import com.ruoyi.logistics.service.IQcLogisticsTrackingService;
import com.ruoyi.logistics.service.IQclogisticsTrackingRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.InputStream;
import java.util.List;
import java.util.Optional;

/**
 * 物流追踪Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-24
 */
@Service
public class QcLogisticsTrackingEsServiceImpl implements IQcLogisticsTrackingEsService {
    @Autowired
    private QcLogisticsTrackingMapper qcLogisticsTrackingMapper;
    @Autowired
    private ElasticsearchRestTemplate restTemplate;

    @Resource(name = "threadPoolTaskExecutor")
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
    @Autowired
    private IQclogisticsTrackingRepository qclogisticsTrackingRepository;

    @Override
    public QcLogisticsTrackingEsDTO saveQcLogisticsTracking(QcLogisticsTrackingEsDTO qcLogisticsTrackingEsDTO) {
        return restTemplate.save(qcLogisticsTrackingEsDTO);
    }

    /**
     * 批量加入
     *
     * @param list
     * @return
     */
    @Override
    public void saveQcLogisticsTrackingList(List<QcLogisticsTrackingEsDTO> list) {
        Iterable<QcLogisticsTrackingEsDTO> qcLogisticsTrackingEsDTOS = qclogisticsTrackingRepository.saveAll(list);
    }

}
